# !/usr/bin/python
# -*-coding:utf-8 -*-
"""
@File    :   utils.py
@Create  :   2021/8/28 21:06
@Author  :   David
"""


def jwt_response_payload_handler(token, user=None, request=None):
    """
    自定义jwt认证成功后返回数据
    """
    return {
        'msg': '登录成功',
        'user_id': user.id,
        'username': user.username,
        'token': token
    }


def jwt_response_payload_error_handler(serializer, request=None):
    """
    自定义jwt认证失败后返回数据
    """
    return {'msg': '用户名或密码错误'}
